﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;

namespace ESOL.Common.Entity
{
    [DataContract]
    public class SalesAppQueryCondition
    {
        [DataMember]
        [Required()]
        public string curUserId { set; get; }
        [DataMember]
        public int txtPageIndex { set; get; }
        [DataMember]
        public int txtPageSize { set; get; }
        [DataMember]
        public int isActive { set; get; }
        [DataMember]
        public string AppNo { set; get; }
        [DataMember]
        public string SoNo { set; get; }
        [DataMember]
        public string CustomerId { set; get; }
        [DataMember]
        public string CustomerName { set; get; }
        [DataMember]
        public string ContactPerson { set; get; }
        [DataMember]
        public string AppPerson { set; get; }
        [DataMember]
        public string PaymentType { set; get; }
        [DataMember]
        public string TranType { set; get; }
        [DataMember]
        public string DeliveryType { set; get; }
        [DataMember]
        public string Status { set; get; }
        [DataMember]
        public string ContractModel { set; get; }
    }

    [DataContract]
    public class SalesAppPageResult
    {
        [DataMember]
        public string UserNo { set; get; }
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesAppEntity> results { set; get; }
    }

    [DataContract]
    public class SalesAppSaveParam
    {
        [DataMember]
        public string curUserNo { set; get; }
        [DataMember]
        public SalesAppEntity app { set; get; }
        [DataMember]
        public List<SalesAppItemEntity> addItems { set; get; }
        [DataMember]
        public List<SalesAppItemEntity> updatedItems { set; get; }
        [DataMember]
        public List<SalesAppItemEntity> delItems { set; get; }
        [DataMember]
        public List<SalesRlSoAppEntity> rls { set; get; }
    }

    [DataContract]
    public class SalesSoQueryCondition
    {
        [DataMember]
        public string curUserId { set; get; }
        [DataMember]
        public int txtPageIndex { set; get; }
        [DataMember]
        public int txtPageSize { set; get; }
        [DataMember]
        public string customerId { set; get; }
        [DataMember]
        public string customerName { set; get; }
        [DataMember]
        public string soNo { set; get; }
        [DataMember]
        public string soUser { set; get; }
        [DataMember]
        public string currency { set; get; }
        [DataMember]
        public string deliveryWay { set; get; }
        [DataMember]
        public string packageType { set; get; }
        [DataMember]
        public DateTime dtpSoDateFrom { set; get; }
        [DataMember]
        public DateTime dtpSoDateTo { set; get; }
        [DataMember]
        public string Status { set; get; }
        [DataMember]
        public string ContractModel { set; get; }
    }

    [DataContract]
    public class SalesSo
    {
        [DataMember]
        public string Id { set; get; }

        [DataMember]
        public DateTime CreatedDate { set; get; }

        [DataMember]
        public string CreatedBy { set; get; }

        [DataMember]
        public DateTime UpdatedDate { set; get; }

        [DataMember]
        public string UpdatedBy { set; get; }

        [DataMember]
        public int IsActive { set; get; }

        [DataMember]
        public string CompanyId { set; get; }

        [DataMember]
        public string SobId { set; get; }

        [DataMember]
        public string SoNo { set; get; }

        [DataMember]
        public string QuoteOrderId { set; get; }

        [DataMember]
        public string ContactId { set; get; }

        [DataMember]
        public string CustomerId { set; get; }

        [DataMember]
        public string CustomerName { set; get; }

        [DataMember]
        public string CustomerCode { set; get; }

        [DataMember]
        public string OrderDept { set; get; }

        [DataMember]
        public string OrderPerson { set; get; }

        [DataMember]
        public DateTime OrderDate { set; get; }

        [DataMember]
        public decimal TotalAmount { set; get; }

        [DataMember]
        public string Currency { set; get; }

        [DataMember]
        public string DeliveryAdd { set; get; }

        [DataMember]
        public string TransportType { set; get; }

        [DataMember]
        public string PackageType { set; get; }

        [DataMember]
        public string PaymentType { set; get; }

        [DataMember]
        public string Remark { set; get; }

        [DataMember]
        public int IsEffective { set; get; }

        [DataMember]
        public string Status { set; get; }

        [DataMember]
        public int selectedFlag { set; get; }
    }

    [DataContract]
    public class SalesSoSaveParam
    {
        [DataMember]
        public SalesSoEntity so { set; get; }
        [DataMember]
        public List<SalesSoItemEntity> addItems { set; get; }
        [DataMember]
        public List<SalesSoItemEntity> updatedItems { set; get; }
        [DataMember]
        public List<SalesSoItemEntity> delItems { set; get; }
        [DataMember]
        public List<SalesRlSoAppEntity> rls { set; get; }
    }

    [DataContract]
    public class SalesSoPageResult
    {
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesSo> results { set; get; }
    }

    [DataContract]
    public class SalesSoItem
    {
        [DataMember]
        public string Id { set; get; }
        [DataMember]
        public string SoId { set; get; }
        [DataMember]
        public string SoNo { set; get; }
        [DataMember]
        public string ContactId { set; get; }
        [DataMember]
        public string MaterialId { set; get; }
        [DataMember]
        public string MaterialName { set; get; }
        [DataMember]
        public string MaterialCode { set; get; }
        [DataMember]
        public string MaterialSpec { set; get; }
        [DataMember]
        public string Material { set; get; }
        [DataMember]
        public string ContractModel { set; get; }
        [DataMember]
        public decimal SuggestPrice { set; get; }
        [DataMember]
        public decimal Qty { set; get; }
        [DataMember]
        public string Unit { set; get; }
        [DataMember]
        public decimal Price { set; get; }
        [DataMember]
        public decimal TaxRate { set; get; }
        [DataMember]
        public int IsTax { set; get; }
        [DataMember]
        public decimal SubTotal { set; get; }
        [DataMember]
        public decimal DiameterOut { set; get; }
        [DataMember]
        public decimal DiameterIn { set; get; }
        [DataMember]
        public decimal Length { set; get; }
        [DataMember]
        public DateTime DeliveryDate { set; get; }
        [DataMember]
        public string Remark { set; get; }

        [DataMember]
        public string CustomerId { set; get; }
        [DataMember]
        public string CustomerName { set; get; }

        [DataMember]
        public int SelectedFlag { set; get; }
    }

    [DataContract]
    public class SalesSoItemPageResult
    {
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesSoItem> SoItems { set; get; }

    }

    [DataContract]
    public class SalesProdAppItem
    {
        [DataMember]
        public string Id { set; get; }
        [DataMember]
        public string AppId { set; get; }
        [DataMember]
        public string AppNo { set; get; }
        [DataMember]
        public string ContactUser { set; get; }
        [DataMember]
        public string ContactId { set; get; }
        [DataMember]
        public DateTime ReqDeliveryDate { set; get; }
        [DataMember]
        public string ProductId { set; get; }
        [DataMember]
        public string ProductName { set; get; }
        [DataMember]
        public string ProductCode { set; get; }
        [DataMember]
        public string ProductSpec { set; get; }
        [DataMember]
        public string Material { set; get; }
        [DataMember]
        public string CustomerModel { set; get; }
        [DataMember]
        public string Length { set; get; }
        [DataMember]
        public string Unit { set; get; }
        [DataMember]
        public decimal Qty { set; get; }
        [DataMember]
        public int IsTax { set; get; }
        [DataMember]
        public decimal Price { set; get; }
        [DataMember]
        public decimal SubTotal { set; get; }
        [DataMember]
        public string PriceType { set; get; }
        [DataMember]
        public string ProductType { set; get; }
        [DataMember]
        public string PackageType { set; get; }
        [DataMember]
        public string Remark { set; get; }
        [DataMember]
        public string Status { set; get; }

        [DataMember]
        public string CustomerId { set; get; }
        [DataMember]
        public string CustomerName { set; get; }

        [DataMember]
        public int SelectedFlag { set; get; }
    }

    [DataContract]
    public class SalesProdAppItemPageResult
    {
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesProdAppItem> ProdAppItems { set; get; }

    }

    //销售报价单
    [DataContract]
    public class SalesQuSaveParam
    {
        [DataMember]
        public string curUserNo { set; get; }
        [DataMember]
        public SalesQuEntity qu { set; get; }
        [DataMember]
        public List<SalesQuItemEntity> addItems { set; get; }
        [DataMember]
        public List<SalesQuItemEntity> updatedItems { set; get; }
        [DataMember]
        public List<SalesQuItemEntity> delItems { set; get; }
    }

    [DataContract]
    public class SalesQuQueryCondition
    {
        [DataMember]
        public string curUserNo { set; get; }
        [DataMember]
        public int txtPageIndex { set; get; }
        [DataMember]
        public int txtPageSize { set; get; }
        [DataMember]
        public int isActive { set; get; }
        [DataMember]
        public string QuNo { set; get; }
        [DataMember]
        public string CustomerId { set; get; }
        [DataMember]
        public string CustomerName { set; get; }
        [DataMember]
        public string CustomerContact { set; get; }
        [DataMember]
        public DateTime QuDate { set; get; }
        [DataMember]
        public DateTime QuDateTo { set; get; }
        [DataMember]
        public string QuUser { set; get; }
        [DataMember]
        public string Status { set; get; }

    }

    [DataContract]
    public class SalesQuPageResult
    {
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesQuEntity> QuOrders { set; get; }
    }

    //销售发货单
    [DataContract]
    public class SalesShipSaveParam
    {
        [DataMember]
        public string curUserNo { set; get; }
        [DataMember]
        public SalesShipEntity ship { set; get; }
        [DataMember]
        public List<SalesShipItemEntity> addItems { set; get; }
        [DataMember]
        public List<SalesShipItemEntity> updatedItems { set; get; }
        [DataMember]
        public List<SalesShipItemEntity> delItems { set; get; }
    }

    [DataContract]
    public class SalesShipQueryCondition
    {
        [DataMember]
        public string curUserId { set; get; }
        [DataMember]
        public int txtPageIndex { set; get; }
        [DataMember]
        public int txtPageSize { set; get; }

        [DataMember]
        public string ShipNo { set; get; }
        [DataMember]
        public string AppId { set; get; }
        [DataMember]
        public string AppNo { set; get; }
        [DataMember]
        public string Type { set; get; }
        [DataMember]
        public DateTime ShipDate { set; get; }
        [DataMember]
        public DateTime ShipDateTo { set; get; }
        [DataMember]
        public string ShipPerson { set; get; }
        [DataMember]
        public string ShipPersonName { set; get; }
        [DataMember]
        public string CustomerId { set; get; }
        [DataMember]
        public string CustomerName { set; get; }
        [DataMember]
        public string TransportType { set; get; }
        [DataMember]
        public int IsActive { set; get; }
        [DataMember]
        public string ContractModel { set; get; }
        [DataMember]
        public string Status { set; get; }

    }

    [DataContract]
    public class SalesShipPageResult
    {
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesShipEntity> Shipes { set; get; }
    }

    //销售退货单
    [DataContract]
    public class SalesRoSaveParam
    {
        [DataMember]
        public string curUserNo { set; get; }
        [DataMember]
        public SalesRoEntity ro { set; get; }
        [DataMember]
        public List<SalesRoItemDto> addItems { set; get; }
        [DataMember]
        public List<SalesRoItemDto> updatedItems { set; get; }
        [DataMember]
        public List<SalesRoItemDto> delItems { set; get; }
    }

    [DataContract]
    public class SalesRoQueryCondition
    {
        [DataMember]
        public string curUserId { set; get; }
        [DataMember]
        public int txtPageIndex { set; get; }
        [DataMember]
        public int txtPageSize { set; get; }

        [DataMember]
        public string RoNo { set; get; }
        [DataMember]
        public string SalesProdAppNo { set; get; }
        [DataMember]
        public string CustomerId { set; get; }
        [DataMember]
        public string CustomerName { set; get; }
        [DataMember]
        public int IsActive { set; get; }
        [DataMember]
        public string Status { set; get; }
        [DataMember]
        public string ContractModel { set; get; }

    }

    [DataContract]
    public class SalesRoPageResult
    {
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesRoEntity> ReturnOrders { set; get; }
    }

    [DataContract]
    public class SalesRoItemDto
    {
        [DataMember]
        public string Id { set; get; }

        [DataMember]
        public string RoId { set; get; }

        [DataMember]
        public string RoNo { set; get; }

        [DataMember]
        public string SalesAppItemId { set; get; }

        [DataMember]
        public string MaterialId { set; get; }

        [DataMember]
        public string MaterialName { set; get; }

        [DataMember]
        public string MaterialCode { set; get; }

        [DataMember]
        public DateTime DeliveryDate { set; get; }

        [DataMember]
        public decimal Qty { set; get; }

        [DataMember]
        public decimal ReturnQty { set; get; }

        [DataMember]
        public string Unit { set; get; }

        [DataMember]
        public decimal Price { set; get; }

        [DataMember]
        public decimal SubTotal { set; get; }

        [DataMember]
        public DateTime ActuralArvDate { set; get; }

        [DataMember]
        public decimal ActuralArvQty { set; get; }

        [DataMember]
        public string LocationNo { set; get; }
        [DataMember]
        public string ContractModel { set; get; }

        [DataMember]
        public int IsFree { set; get; }

        [DataMember]
        public decimal ShipedQty { set; get; }
        [DataMember]
        public decimal ArvQty { set; get; }
        
    }

    //客户汇总表
    [DataContract]
    public class SalesCustomerSummaryQueryCondition
    {
        [DataMember]
        public string curUserId { set; get; }
        [DataMember]
        public int txtPageIndex { set; get; }
        [DataMember]
        public int txtPageSize { set; get; }

        [DataMember]
        public string CompanyId { set; get; }
        [DataMember]
        public string SobId { set; get; }
        [DataMember]
        public string CustomerId { set; get; }
        [DataMember]
        public string CustomerName { set; get; }
        [DataMember]
        public string CustomerType { set; get; }
        [DataMember]
        public string CustomerLevel { set; get; }
        [DataMember]
        public string SalesmanNo { set; get; }

        [DataMember]
        public DateTime SalesAppCreatedDate { set; get; }
        [DataMember]
        public DateTime SalesAppCreatedDateTo { set; get; }
    }

    [DataContract]
    public class SalesCustomerSummaryDto
    {
        [DataMember]
        public string CustomerId { set; get; }
        [DataMember]
        public string CustomerName { set; get; }
        [DataMember]
        public string CustomerCode { set; get; }
        [DataMember]
        public int SalesAppCount { set; get; }
        [DataMember]
        public List<string> SalesAppList { set; get; }
        [DataMember]
        public int SalesAppUnclosedCount { set; get; }
        [DataMember]
        public List<string> SalesAppUnclosedList { set; get; }
        [DataMember]
        public decimal SalesAmount { set; get; }//销售金额
        [DataMember]
        public decimal ShipedAmount { set; get; }//发货金额
        [DataMember]
        public decimal ReturnAmount { set; get; }//退货金额
        [DataMember]
        public decimal RevAmount { set; get; }//收款金额
        [DataMember]
        public decimal InvoiceAmount { set; get; }//开票金额
        [DataMember]
        public string CustomerStatus { set; get; }
    }

    [DataContract]
    public class SalesCustomerSummeryPageResult
    {
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesCustomerSummaryDto> SummaryDto { set; get; }
    }

    [DataContract]
    public class SalesProdAppFinishDialogDto
    {
        [DataMember]
        public string AppItemId { set; get; }
        [DataMember]
        public string AppId { set; get; }
        [DataMember]
        public int Operation { set; get; }
        [DataMember]
        public string ModelContract { set; get; }
        [DataMember]
        public string Material { set; get; }
        [DataMember]
        public string ProductId { set; get; }
        [DataMember]
        public string MaterialName { set; get; }
        [DataMember]
        public string MaterialCode { set; get; }
        [DataMember]
        public string Std { set; get; }
        [DataMember]
        public decimal Qty { set; get; }
        [DataMember]
        public DateTime DeliveryTime { set; get; }
        [DataMember]
        public DateTime BptAppReqTime { set; get; }
        [DataMember]
        public DateTime ProdPoReqTime { set; get; }
        [DataMember]
        public List<BptBlueprintDto> BpsDto { set; get; }
        [DataMember]
        public int BpCount { set; get; }

    }

    [DataContract]
    public class BptBlueprintDto
    {
        [DataMember]
        public string BlueprintId { set; get; }
        [DataMember]
        public string ParentId { set; get; }
        [DataMember]
        public string BptTaskId { set; get; }
        [DataMember]
        public string BptTaskCode { set; get; }
        [DataMember]
        public string BlueprintCode { set; get; }
        [DataMember]
        public string BlueprintType { set; get; }
        [DataMember]
        public string FileName { set; get; }
        [DataMember]
        public DateTime UpdatedDate { set; get; }
        [DataMember]
        public string UpdatedBy { set; get; }
        [DataMember]
        public string UpdatedUser { set; get; }
        [DataMember]
        public string Remark { set; get; }

    }

    [DataContract]
    public class SalesProdAppFinishResult
    {
        [DataMember]
        public string AppItemId { set; get; }
        [DataMember]
        public int Operation { set; get; }
        [DataMember]
        public string BptAppId { set; get; }
        [DataMember]
        public string ProdPoId { set; get; }
    }

    //客户业务清单
    [DataContract]
    public class SalesCutomerBusinessListQueryCondition
    {
        [DataMember]
        public string curUserId { set; get; }
        [DataMember]
        public int txtPageIndex { set; get; }
        [DataMember]
        public int txtPageSize { set; get; }

        [DataMember]
        public string CustomerNo { set; get; }
        [DataMember]
        public string ContractModel { set; get; }
        [DataMember]
        public string ItemType { set; get; }
        [DataMember]
        public string SalesAppNo { set; get; }
        [DataMember]
        public string ItemCode { set; get; }
        [DataMember]
        public string ProductType { set; get; }
        [DataMember]
        public DateTime AppDate { set; get; }
        [DataMember]
        public DateTime AppDateTo { set; get; }
        [DataMember]
        public DateTime DeliveryDate { set; get; }
        [DataMember]
        public DateTime DeliveryDateTo { set; get; }

    }

    [DataContract]
    public class SalesCutomerBusinessListDto:SalesAppItemEntity
    {
        [DataMember]
        public int SelectedFlag { set; get; }
        [DataMember]
        public List<string> SalesSoNo { set; get; }
        [DataMember]
        public string SalesSoNoStr { set; get; }
        [DataMember]
        public DateTime SalesAppDate { set; get; }

        [DataMember]
        public decimal BindedContractQty { set; get; }
        [DataMember]
        public decimal UnbindedContractQty { set; get; }
        [DataMember]
        public decimal ShipedQty { set; get; }
        [DataMember]
        public decimal UnshipedQty { set; get; }
        [DataMember]
        public decimal ReturnedQty { set; get; }
        [DataMember]
        public decimal ReturnAmount { set; get; }
        
    }

    [DataContract]
    public class SalesAppBindSoDto : SalesRlSoAppEntity
    {
        [DataMember]
        public string SoNo { set; get; }
        [DataMember]
        public string AppNo { set; get; }
    }

    [DataContract]
    public class SalesCutomerBusinessListPageResult
    {
        [DataMember]
        public int TotalCount { set; get; }
        [DataMember]
        public List<SalesCutomerBusinessListDto> BusinessListDto { set; get; }
    }

}
